import React, { Component } from 'react'
import { Text, View, StyleSheet, TextInput, TouchableHighlight } from 'react-native'


export default class Login extends Component {
	constructor(props) {
		super(props)

		this.state = {
			user: '',
			pwd: ''
		}
	}
	_login = () => {
		this.setState({ loginstate: true })
		alert('登陆成功')
		this.props.navigation.navigate("主页")
	}
	_onChangeUser = user => {
		this.setState({ user })
	}
	_onChangePwd = pwd => {
		this.setState({ pwd })
	}
	render() {
		return (
			<View style={{ flex: 1, backgroundColor: 'skyblue' }}>
				<View style={{ marginLeft: 5, marginTop: 10, }}>
					<Text style={{ fontSize: 30 }}>登录</Text>

				</View>
				<View style={styles.inputview}>
					<TextInput style={styles.input} onChangeText={this._onChangeUser} placeholder="用户名" ></TextInput>
					<TextInput style={styles.input} onChangeText={this._onChangePwd} placeholder="密码"></TextInput>
					<View style={{ flexDirection: 'row' }}>
						<TouchableHighlight style={styles.Btn} onPress={this._login}>
							<Text style={{ fontSize: 20, color: 'white' }}>登录</Text>
						</TouchableHighlight>
						<Text style={{ marginLeft: 30 }}>注册新账号</Text>
					</View>



				</View>
			</View>
		)
	}
}
const styles = StyleSheet.create({
	logintext: {
		fontSize: 30,

	},
	inputview: {
		display: 'flex',
		justifyContent: 'center',
		flexDirection: 'column',
		alignItems: 'center',
		flex: 1,
	},
	input: {
		height: 40,
		width: 250,
		borderRadius: 20,
		marginBottom: 20,
		borderWidth: 1,
		borderColor: 'grey'
	},
	Btn: {
		height: 36,
		width: 72,
		backgroundColor: 'red',
		borderRadius: 20,
		alignItems: 'center',
		justifyContent: 'center',
		marginLeft: 115
	},
})
